package com.tec.security.utils.mail;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import javax.mail.MessagingException;

@Service
public class ScheduledEmailService {
    private final MailService mailService;
    @Autowired
    public ScheduledEmailService(MailService mailService) {
        this.mailService = mailService;
    }
    @Scheduled(cron = "0 0 23 1/1 1/1 ? ")
    public void emailTask() throws MessagingException {
        mailService.commonScheduledEmail();
        System.out.println("发送成功");
    }
}
